<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function User(name) {
        this.name = name;
      }
      // User.prototype.get = function () {
      //   return '后盾人' + this.name;
      // };
      let lisi = new User('小明');

      let wangwu = new User('王五');
      console.log(lisi.get == wangwu.get); //true
      //通过修改原型方法会影响所有对象调用，因为方法是共用的
      lisi.__proto__.get = function () {
        return '后盾人' + this.name;
      };
      console.log(lisi.get());
      console.log(lisi.get());
      console.log(wangwu.get());
    </script>
  </body>
</html>
